import { ref } from 'vue'
import { userList } from "@/api/userList/index"
import { projectList } from "@/api/projectList/index"
function useDataList() {
	//企业列表
	let userList_data = ref([])
	let getUserList= (): void => {
		userList().then(res => {
			let { rows } = res
			userList_data.value = rows.map(item => {
				item.text = item.enterpriseName
				item.value = item.enterpriseId
				return item
			})
		})
	}
	
	//项目列表
	let projectList_data = ref([])
	let getProjectList= (): void => {
		projectList().then(res => {
			let { rows } = res
			projectList_data.value = rows.map(item => {
				item.text = item.projectName
				item.value = item.projectId
				return item
			})
		})
	}

	return {
		getUserList,
		userList_data,
		getProjectList,
		projectList_data
	}
}

export default useDataList